<?php
$this->breadcrumbs=array(
	t('Member','web')=>'/member/index/index',
	'店铺管理'=>'/member/registercompany',
	'我要开店'=>'/member/registercompany',
);

//获取二级分类
$criteria=new CDbCriteria;
$criteria->compare('zca_topid',0);
$criteria->compare('zca_parentid','>0');
$secondCate = Category::model()->findAll($criteria);

?>

<div class="hr_12"></div>
<!--我要开店 start-->
<div class="shop_box bd_db">
	<div class="shop_set" id="apply_online">
		<h2 class="fs_14">在线申请</h2>
		<?php $form=$this->beginWidget('CActiveForm', array(
				'id'=>'CompanyCard-form',
				'enableAjaxValidation'=>false,
			)); ?>
			<ul class="form_list form_list2">
				<li class="c_f"><span class="tit">会员类型：</span>
					<div class="cont f_l">
					<?php echo $form->radioButtonList($model,'zoa_type',CompanyCard::model()->getZoaType(),array('labelOptions'=>array('class'=>'mr20'),'class'=>'radio'))?>
					</div>
				</li>
				<li class="c_f"><span class="tit"><em class="xing">*</em>主营类目：</span>
					<div class="cont f_l">
						<select class="s_ipt w_250" id="Compnay_zca_id" name="CompanyCard[zca_id]">
							<?php foreach($secondCate as $val){?>
							<option selected="selected" value="<?php echo $val->zca_id?>" deposit="<?php echo $val->zca_deposit?>"><?php echo $val->zca_title?></option>
							<?php } ?>
						</select>
						<span>类目保证金：<strong class="c_f60">25000.00</strong>元</span>
					</div>
				</li>
				<li class="c_f"><span class="tit"><em class="xing">*</em>身份证号码：</span>
					<div class="cont f_l">
						<?php echo $form->textField($model,'zoa_id_card',array('class'=>'t_ipt w_250'))?>
						<?php echo $form->error($model,'zoa_id_card')?>
					</div>
				</li>
				<li class="c_f"><span class="tit"><em class="xing">*</em>手持身份证头部照：</span>
					<div class="cont f_l">
						<div class="uploadphoto f_l">
							<?php echo CHtml::image(empty($model->zoa_id_pic)?'/images/photo_01.jpg':$model->zoa_id_pic,'',array('id'=>'img1','width'=>120,'height'=>90))?>
							<?php echo CHtml::link('上传'.CHtml::fileField('image','',array('id'=>'uploadimg1','multiple'=>true)),'javascript:',array('class'=>' filelink mem_bgx btn_upload','onclick'=>"uploadimg('1')"))?>
							<?php echo $form->hiddenField($model,'zoa_id_pic',array('id'=>'proimage1'))?>
						</div>
						<div class="example f_l">
							<span class="f_l">示例：</span>
							<div class="photo f_l"><img src="/images/example_01.jpg" width="120" height="90" alt="" /><span class="ico_big"></span></div>
							<div class="disc f_l">
								<p>1. 请手持相关证件，临时身份证有效期15天以上。</p> 
								<p>2. 照片需免冠，建议未化妆，需身份证本人手持证件。</p>
								<p>3. 必须看清证件号且证件号不能被遮挡。</p>
								<p>4. 照片支持jpg、jpeg、bmp格式，最大不超过5M。</p>
							</div>
						</div>
					</div>
				</li>
				<li class="c_f"><span class="tit"><em class="xing">*</em>半身照：</span>
					<div class="cont f_l">
						<div class="uploadphoto f_l">
							<?php echo CHtml::image(empty($model->zoa_body_pic)?'/images/photo_02.jpg':$model->zoa_body_pic,'',array('id'=>'img2','width'=>120,'height'=>90))?>
							<?php echo CHtml::link('上传'.CHtml::fileField('image','',array('id'=>'uploadimg2','multiple'=>true)),'javascript:',array('class'=>' filelink mem_bgx btn_upload','onclick'=>"uploadimg('2')"))?>
							<?php echo $form->hiddenField($model,'zoa_body_pic',array('id'=>'proimage2'))?>
						</div>
						<div class="example f_l">
							<span class="f_l">示例：</span>
							<div class="photo f_l"><img src="/images/example_02.jpg" width="120" height="90" alt="" /><span class="ico_big"></span></div>
							<div class="disc f_l">
								<p>1. 半身照与手持证件照需在同一场景下拍摄。</p> 
								<p>2. 大头照和一寸照不可作为半身照使用。</p>
								<p>3.  照片不能进行软件处理，包括裁剪，涂改。</p>
								<p>4. 照片支持jpg、jpeg、bmp格式，最大不超过5M。</p>
							</div>
						</div>
					</div>
				</li>
				<li class="c_f license d_n"><span class="tit"><em class="xing">*</em>营业执照：</span>
					<div class="cont f_l">
						<div class="uploadphoto f_l">
							<?php echo CHtml::image(empty($model->zoa_license_pic)?'/images/photo_03.jpg':$model->zoa_license_pic,'',array('id'=>'img3','width'=>120,'height'=>90))?>
							<?php echo CHtml::link('上传'.CHtml::fileField('image','',array('id'=>'uploadimg3','multiple'=>true)),'javascript:',array('class'=>' filelink mem_bgx btn_upload','onclick'=>"uploadimg('3')"))?>
							<?php echo $form->hiddenField($model,'zoa_license_pic',array('id'=>'proimage3'))?>
						</div>
						<div class="example f_l">
							<span class="f_l">示例：</span>
							<div class="photo f_l"><img src="/images/example_03.jpg" width="120" height="90" alt="" /><span class="ico_big"></span></div>
							<div class="disc f_l">
								<p>1. 企业法人营业执照可以传正或副本。</p> 
								<p>2. 要求执照的图片字迹清晰。</p>
								<p>3.  照片不能进行软件处理，包括裁剪，涂改。</p>
								<p>4. 照片支持jpg、jpeg、bmp格式，最大不超过5M。</p>
							</div>
						</div>
					</div>
				</li>
				<li class="c_f"><span class="tit">&nbsp;</span>
					<div class="cont f_l">
						<?php echo CHtml::submitButton('提交资料',array('class'=>'mem_btn mem_btn05'))?>
					</div>
				</li>
			</ul>                    	
		<?php $this->endWidget(); ?>
	</div>
</div>
<!--我要开店 end-->


<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.ui.widget.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.iframe-transport.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.fileupload.js"></script>  

<script teyp="text/javascript">
//上传图片
function uploadimg (id) {
	   $('#uploadimg'+id).fileupload({         	
	        dataType: 'json',       
	        url: '/Attachment/GetAjax',        
	        success: function (json) {
	               if(json.upfile.errors=='1'){
	               		alert(json.upfile.msg);
	               }else if(json.upfile.errors=='2'){
	               		alert(json.upfile.msg);
	               }else{
		                 //修改按钮图标
		            	 $('#img'+id).attr('src',json.upfile.file);
						 //修改按钮文本
		            	 $('#uploadimg'+id).parent().html('修改图片<input type="file" id="uploadimg'+id+'" multiple name="image"/>');
		            	 //填加删除按钮
		            	 if(!$('#img'+id).parent().find('a')[1]){
		            	 }
						 //修改隐藏域值
	               		 $('#proimage'+id).attr('value',json.upfile.file);
	               } 	
	        }
	    });
};


//选择行业分类
$('#Compnay_zca_id').bind('change',function(){
	var deposit = $('#Compnay_zca_id option:selected').attr('deposit');
	$(this).next('span').find('strong').text(deposit);
});

//选择会员类型
$('.radio').bind('click',function(){
	var zoa_type = $(this).val();
	if(zoa_type==1){
		$('.license').hide();
	}else{
		$('.license').show();
	}
});
</script>
